package com.ryg.animatemenu;

import android.app.Activity;
import android.content.Context;
import android.util.DisplayMetrics;
import android.util.Log;

public class WindowManageUtil {

	public static float WindowD(Activity activity) {
		DisplayMetrics metric = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(metric);
		return metric.density;// 屏幕密度（0.75 / 1.0 / 1.5）
	}
	
	public static int WindowW(Activity activity){
		DisplayMetrics metric = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(metric);
		return metric.widthPixels;// 屏幕宽度（像素）
	}
	
	public static int WindowH(Activity activity){
		DisplayMetrics metric = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(metric);
		return metric.heightPixels;// 屏幕高度（像素）
	}
	
	public static int WindowDD(Activity activity){
		DisplayMetrics metric = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(metric);
		return metric.densityDpi;// 屏幕密度DPI（120 / 160 / 240）
	}
	
	public static int getWindMannageD(Activity activity){
		int animate = 0;
		if (WindowManageUtil.WindowD(activity) > 3.0) {
			animate = 500;
			Log.i("TAG", "超大屏幕手机：" + 500 + " 密度：" + WindowManageUtil.WindowD(activity));
		} else if (WindowManageUtil.WindowD(activity) > 2.0 && WindowManageUtil.WindowD(activity) <= 3.0) {
			animate = 400;
			Log.i("TAG", "大屏幕手机：" + 400 + " 密度：" + WindowManageUtil.WindowD(activity));
		} else if (WindowManageUtil.WindowD(activity) > 1.5 && WindowManageUtil.WindowD(activity) <= 2.0) {
			animate = 300;
			Log.i("TAG", "普通屏幕手机：" + 300 + " 密度：" + WindowManageUtil.WindowD(activity));
		} else if (WindowManageUtil.WindowD(activity) <= 1.5) {
			animate = 200;
			Log.i("TAG", "小屏幕手机：" + 200 + " 密度：" + WindowManageUtil.WindowD(activity));
		}
		return animate;
	}
}
